package com.diaohw.module.auth.controller;

import com.diaohw.module.auth.obj.vo.AccountOnlineVO;
import com.diaohw.module.auth.service.OnlineService;
import com.diaohw.platform.common.obj.page.PageDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "登录用户在线管理")
@RestController
@RequestMapping("/online")
public class OnlineController {

    @Resource
    OnlineService onlineService;

    @GetMapping
    @Operation(summary = "在线用户")
    public List<AccountOnlineVO> list(PageDto page) {
        return onlineService.list(page);
    }

    @DeleteMapping("/{loginId}")
    @Operation(summary = "强制下线")
    public boolean kickOut(@PathVariable("loginId") String loginId) {
        return onlineService.kickOut(loginId);
    }
}
